#!/bin/bash

if [[ $(uname) == 'Linux' ]]; then
    if ! aclocal-1.9 -I $PWD > /dev/null 2>&1
	then
	echo 'error: aclocal failed'
	exit 1
    fi
    autoconf
    automake-1.9
fi

prefix=$(type slsh | cut -d' ' -f3 | awk -F'bin' '{print $1}')

if [[ $(uname) == 'Darwin' ]]; then
    ./configure --prefix=$prefix --with-slang=$prefix \
	LDFLAGS="-Xcompiler -F${prefix}/Library/Frameworks"
else
    ./configure --prefix=$prefix --with-slang=$prefix 
fi
